package com.zretc.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import com.zretc.dao.AdminDao;
import com.zretc.util.DBUtil;

public class AdminDaoImpl implements AdminDao{

	@Override
	public Map<String, String> findAdminByNameAndPwd(String admin_name, String admin_pwd) {
	
		Map<String, String> map = null;
		ResultSet doQuery = DBUtil.doQuery("select admin_name,admin_pwd from admin where admin_name=? and admin_pwd=?", admin_name,admin_pwd);
		try {
			while(doQuery.next()) {
				map = new HashMap<>();
				String adminName = doQuery.getString("admin_name");
				String adminPwd = doQuery.getString("admin_pwd");
				map.put("adminName", adminName);
				map.put("adminPwd", adminPwd);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return map;
	}

}
